<template lang="pug">
el-dialog(title="交易记录" :visible.sync="cus" :before-close="close" append-to-body)
    el-table(:data="td" style="width:100%" tooltip-effect="dark" v-loading="loading" element-loading-text="数据加载中...")
        el-table-column(prop="recorderMonney" label="金额")
        el-table-column(prop="remark" label="记录")
        el-table-column(prop="createTime" label="交易时间")
            template(slot-scope="scope") 
                div {{new Date(scope.row.createTime).toLocaleString().replace(/:\d{1,2}$/,' ')}}
    el-row
        el-col(:span="16" :offset="8")
            el-pagination(@size-change="size" @current-change="hCChange" :current-page="currentpage" :page-size="10" layout="total,prev,pager,next,jumper" :total="count")         
</template>
<script>
    export default{
        data(){
            return{
                cus:false,
                currentpage:1,
                td:[],
                count:0,
                phonedata:-1,
                loading:false
            }
        },
        computed:{
            getstate(){
                return this.$store.state.cusdataclass;
            },
            getchange(){
                return this.$store.state.cusdata;
            }
        },
        watch:{
            getstate(val){
                this.cus=val
            },
            getchange(v){
                // console.log("getchange.v.customerMobile",v)
                if(v.customerMobile!=""||v.customerMobile!=undefined){
                    var pp=new URLSearchParams()
                    pp.append("customerMobile",v.customerMobile)
                    this.phonedata=v.customerMobile
                    this.getData(pp)
                }
            }
        },
        methods:{
            close(){//清空数据,关闭弹窗
                this.td=[]
                this.phonedata=-1
                this.$store.state.cusdataclass=false
                this.$store.state.cusdata={}
            },
            size(i){//翻页
                var pp=new URLSearchParams()
                pp.append('customerMobile',this.phonedata)
                pp.append('pageNo',i)
                this.getData(pp)
            },
            hCChange(i){//翻页
                var pp=new URLSearchParams()
                pp.append('customerMobile',this.phonedata)
                pp.append('pageNo',i)
                this.getData(pp)
            },
            getData(v){//获取请求数据
                var _this=this
                this.loading=true
                axios.get('/listDepositRecorder.do',{params:v}).then(r=>{
                    // console.log("客户记录",r)
                    if(r.data.code==200){
                        _this.td=[].concat(r.data.response.depositRecorderList)
                        _this.count=r.data.response.page.totalCount
                    }else{
                        _this.$message.error(r.data.message)
                    }
                    _this.loading=false
                })
            }
        }
    }
</script>
<style>
.el-dialog__header {
    padding: 10px;
    background-color: #20a0ff !important;
}
.el-dialog__title{
    color: #fff !important;
}
</style>
